package com.liuwei.assemble.constants;
/**
 * Description : 
 * @Author Evan Liu
 * @Date 2018年10月26日
 */
import org.apache.commons.lang.StringUtils;

/**
 * Description : 
 * @Author Evan Liu
 * @Date 2018年10月10日
 */
public enum DBDriverEnum {
	MYSQL("mysql","com.mysql.jdbc.Driver"),
	ORACLE("oracle",""),
	SQL_SERVER("sql_server","com.microsoft.sqlserver.jdbc.SQLServerDriver"),
	POSTGRE_SQL("postgre_sql","");

	private String type;
	private String driverName;

	DBDriverEnum(String type,String driverName) {
		this.type = type;
		this.driverName = driverName;
	}
	
	/**
	 * 根据code获取Name
	 * @param code
	 * @return
	 */
	public static String getDriverName(String type) {
		for (DBDriverEnum sde : DBDriverEnum.values()) {
			if (StringUtils.equalsIgnoreCase(type, sde.getType())) {
				return sde.getDriverName();
			}
		}
		return null;
	}

	public String getDriverName(){
		return driverName;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setDriverName(String driverName) {
		this.driverName = driverName;
	}

}




